package com.gtw;

import com.gtw.mediator.*;

public class Client {

    public static void main(String[] args){
        Mediator mediator = new ConcreteMediator();
        /**
         * 同事交互必须依赖中介,所以构造方法注入中介
         */
        ConcreteColleague1 colleague1 = new ConcreteColleague1(mediator);
        ConcreteColleague2 colleague2 = new ConcreteColleague2(mediator);

        /**
         * 注入中介中需要沟通的同事
         */
        mediator.setCc1(colleague1);
        mediator.setCc2(colleague2);

        //同事类工作
        colleague1.selfMethod1();
        colleague1.depMethod1();
    }
}
